package com.fengze.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fengze.common.annotation.Log;
import com.fengze.common.core.controller.BaseController;
import com.fengze.common.core.domain.AjaxResult;
import com.fengze.common.enums.BusinessType;
import com.fengze.business.domain.RemindInfo;
import com.fengze.business.service.IRemindInfoService;
import com.fengze.common.utils.poi.ExcelUtil;
import com.fengze.common.core.page.TableDataInfo;

/**
 * 提醒信息Controller
 * 
 * @author lug
 * @date 2024-02-23
 */
@RestController
@RequestMapping("/remind/info")
public class RemindInfoController extends BaseController
{
    @Autowired
    private IRemindInfoService remindInfoService;

    /**
     * 查询提醒信息列表
     */
    @PreAuthorize("@ss.hasPermi('remind:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(RemindInfo remindInfo)
    {
        startPage();
        List<RemindInfo> list = remindInfoService.selectRemindInfoList(remindInfo);
        return getDataTable(list);
    }

    /**
     * 导出提醒信息列表
     */
    @PreAuthorize("@ss.hasPermi('remind:info:export')")
    @Log(title = "提醒信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RemindInfo remindInfo)
    {
        List<RemindInfo> list = remindInfoService.selectRemindInfoList(remindInfo);
        ExcelUtil<RemindInfo> util = new ExcelUtil<RemindInfo>(RemindInfo.class);
        util.exportExcel(response, list, "提醒信息数据");
    }

    /**
     * 获取提醒信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('remind:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(remindInfoService.selectRemindInfoById(id));
    }

    /**
     * 新增提醒信息
     */
    @PreAuthorize("@ss.hasPermi('remind:info:add')")
    @Log(title = "提醒信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RemindInfo remindInfo)
    {
        return toAjax(remindInfoService.insertRemindInfo(remindInfo));
    }

    /**
     * 修改提醒信息
     */
    @PreAuthorize("@ss.hasPermi('remind:info:edit')")
    @Log(title = "提醒信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RemindInfo remindInfo)
    {
        return toAjax(remindInfoService.updateRemindInfo(remindInfo));
    }

    /**
     * 删除提醒信息
     */
    @PreAuthorize("@ss.hasPermi('remind:info:remove')")
    @Log(title = "提醒信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(remindInfoService.deleteRemindInfoByIds(ids));
    }
}
